<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Killboard.Models.ekbConfig>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	EditConfig
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    List<SelectListItem> bannerList;
    try
    {
        bannerList = Killboard.Models.Banners.GetBanners(Request.MapPath("~/Content/Banners"));
    }
    catch
    {
        bannerList = new List<SelectListItem>();
    }
    SelectListItem none = new SelectListItem();
    none.Text = "no banner";
    none.Value = "";

    bannerList.Insert(0, none);

    string fileName = Model.bannerPath.Substring(Model.bannerPath.LastIndexOf('/') + 1).Trim() ;
    
    
    foreach (SelectListItem item in bannerList)
    {
        if (item.Text == fileName)
        {
            item.Selected = true;
        }
    }
    
%>
    <h2>EditConfig</h2>

    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm()) {%>

            <p class="data">
                Posting Password:<br />
                <%= Html.TextBox("PostingPassword", Model.PostingPassword) %>
                <%= Html.ValidationMessage("PostingPassword", "*") %>
            </p>
            <p class="data">
                <label for="AdminPassword">Admin Password:</label><br />
                <%= Html.TextBox("AdminPassword", Model.AdminPassword) %>
                <%= Html.ValidationMessage("AdminPassword", "*") %>
            </p>
            <p class="data">
                <label for="ApiRetrievalUser">API Retrieval User ID:</label><br />
                <%= Html.TextBox("ApiRetrievalUser", Model.ApiRetrievalUser) %>
                <%= Html.ValidationMessage("ApiRetrievalUser", "*") %>
            </p>
            <p class="data">
                <label for="ApiCharacterNumber">API Character Number:</label><br />
                <%= Html.TextBox("ApiCharacterNumber", Model.ApiCharacterNumber)%>
                <%= Html.ValidationMessage("ApiCharacterNumber", "*")%>
            </p>
            <p class="data">
                <label for="ApiRetrievalKey">API Retrieval Key (must be the full-access key):</label><br />
                <%= Html.TextBox("ApiRetrievalKey", Model.ApiRetrievalKey, new { style="width:500px;" })%>
                <%= Html.ValidationMessage("ApiRetrievalKey", "*") %>
            </p>
            <p class="data">
                <label for="OwningCorpID">Corp ID that Owns this KB:</label><br />
                <%= Html.TextBox("OwningCorpID", Model.OwningCorpID) %> <%=Html.Encode(Model.ekbPlayerCorp.CorpName) %>
                <%= Html.ValidationMessage("OwningCorpID", "*") %>
            </p>
            <p class="data">
                <label for="bannerPath">Banner to Display:</label><br />
                <%= Html.DropDownList("bannerPath", bannerList) %>
                <%= Html.ValidationMessage("bannerPath", "*") %>
            </p>
            
            <p>
                <input type="submit" value="Save" />
            </p>

    <% } %>

    <div>
        <%=Html.ActionLink("Get XML From Eve API", "GetXml") %>
    </div>

</asp:Content>

